<?php
$categories = $mvc->getObject(CategoryService::CATEGORY);
$errors = $mvc->getObject(ContentController::ERROR);
$success = $mvc->getObject(ContentController::STATUS);
?>
<?php if (!isset($success )){?>
<div class="viewLight">
	<h2>_i18n{Edit SubCategory!}</h2>
	<div class="unitABlock unitABlockLast">
	<?php if (isset($errors )){?>
		<div class="itemWarning">
			<ul>
				<li><?php echo $errors ?></li>
			</ul>
		</div>
	<?php } ?>
		<form action="/new-subcategory.html" method="POST">
			<div class="unitSnColumn">
				<div class="itemForm">
					<label>_i18n{Category}:</label>
					<div class="itemData">
						<select name="category_id">
<?php	if (isset($categories) && $categories!=NULL){ 
			foreach($categories as $key=>$category){ ?>
							<option value="<?php echo $category[CategoryService::ID] ?>"><?php echo $category[CategoryService::CAT_NAME] ?></option>
<?php 		} 
		} ?>
						</select>
					</div>
				</div>
				<div class="itemForm">
					<label>_i18n{SubCategory Name}:</label>
					<div class="itemData">
						<input class="inpTxt" type="text" name="subcategory_name" value="<?php echo isset($_POST[SubCategoryService::SUBCAT_NAME])?$_POST[SubCategoryService::SUBCAT_NAME]:NULL;?>" />
					</div>
				</div>

			</div>
			<div class="unitBtn">
				<button><span><strong>_i18n{Save}</strong></span></button>
				<button class="itemHide"><span><strong>_i18n{Discard}</strong></span></button>
			</div>
		</form>
	</div>
</div>
<?php } else {?>
<div class="viewLight">
	<h2>_i18n{Thank you!}</h2>
	<div class="unitABlock unitABlockLast">
		<div class="itemOk">_i18n{SubCategory saved!}</div>
		<div class="unitBtn">
			<button class="itemBack"><span><strong>_i18n{Close}</strong></span></button>
		</div>
	</div>
</div>
<?php }?>